package com.bsoft.gol.hcs.clinical.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import ctd.util.annotation.RpcService;
import hcn.base.reviewdrug.ExamineRequisitionDetail;

import java.math.BigDecimal;
import java.util.List;

public abstract class ExamineRequisitionDetailDAO extends HibernateSupportDelegateDAO<ExamineRequisitionDetail> {

    /**
     * 获取检验明细
     *
     * @param examineRequisitionDetailId
     * @return
     */
    @RpcService
    @DAOMethod(sql = " from ExamineRequisitionDetail where examineRequisitionDetailId =:examineRequisitionDetailId ")
    public abstract ExamineRequisitionDetail getExamineRequisitionDetailById(@DAOParam("examineRequisitionDetailId") String examineRequisitionDetailId);

    @RpcService
    @DAOMethod(sql = " from ExamineRequisitionDetail where examineRequisitionRecordId =:examineRequisitionRecordId ")
    public abstract List<ExamineRequisitionDetail> findExamineRequisitionDetail(@DAOParam("examineRequisitionRecordId") String examineRequisitionRecordId);

    @RpcService
    @DAOMethod(sql = "delete from ExamineRequisitionDetail where examineRequisitionDetailId=:examineRequisitionDetailId")
    public abstract void deleteExamineRequisitionDetail(@DAOParam(value = "examineRequisitionDetailId") String examineRequisitionDetailId);

    @RpcService
    @DAOMethod(sql = "delete from ExamineRequisitionDetail where examineRequisitionRecordId=:examineRequisitionRecordId")
    public abstract void deleteExamineRequisitionDetailByRecordId(@DAOParam(value = "examineRequisitionRecordId") String examineRequisitionRecordId);
    @RpcService
    @DAOMethod(sql = " update ExamineRequisitionDetail set amount=:amount,price=:price," +
            "itemId=:itemId,itemName=:itemName,expenseDetailId=:expenseDetailId" +
            " where examineRequisitionRecordId=:id")
    public abstract void updateExpense(@DAOParam(value = "id")String id, @DAOParam(value = "amount") BigDecimal amount,
                                       @DAOParam(value = "price")BigDecimal price, @DAOParam(value = "itemId")String itemId,
                                       @DAOParam(value = "itemName")String itemName, @DAOParam(value = "expenseDetailId")String expenseDetailId);
}
